/*
 * @Author: 一路向阳 tt_sunzhenfeng@163.com
 * @Date: 2024-02-21 19:31:54
 * @LastEditors: 一路向阳 tt_sunzhenfeng@163.com
 * @LastEditTime: 2024-02-21 19:35:03
 * @FilePath: \utils_ts\19.泛型约束extends.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export {};

type StrOrNum = string | number;
interface PersonItf<N extends StrOrNum, G> {
  name: N; // 需求：N只接受字符串 或者数字
  getName: () => G;
}

const obj: PersonItf<number, number> = {
  name: 1,
  getName() {
    return 1;
  },
}